﻿using LFramework.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace DataServices
{
    /// <summary>
    /// 艺术家分组数据库操作类
    /// 2014-08-17 23：47
    /// </summary>
    public class DaoArtGroup
    {
        IDBHelper dbhelper = DBFactory.CreateFromConfig("conn");

        public IList<string> LoadAllArtGroup()
        {
            string sql = "select * from tbArtGroup";
            DataTable dt = dbhelper.QueryForDataTable(sql);
            IList<string> result = new List<string>();
            foreach (DataRow dr in dt.Rows)
            {
                result.Add(dr["ArtGroup"].ToString());
            }
            return result;
        }

        public void AddArtGroup(string ArtGroupName)
        {
            string sql = "insert into tbArtGroup(ArtGroup) values('"+ArtGroupName+"')";
            dbhelper.ExecuteSQL_InTrans(sql);
        }

        public void DeleteArtGroup(string ArtGroupName)
        {
            string sql = "delete from tbArtGroup where ArtGroup = '" + ArtGroupName + "'";

            dbhelper.ExecuteSQL_InTrans(sql);
        }
    }
}
